<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:useBean id="dataMgr" class="com.group.dataroom.DataMgr"/>
<jsp:useBean id="dataBean" class="com.group.dataroom.DataBean"/>
<jsp:setProperty name="dataBean" property="*"/>
<body bgcolor="beige">
<%
String flag = request.getParameter("flag");
boolean result = false; 
System.out.println(flag);
if(flag.equals("insert")){
	result=dataMgr.insertProduct(request); //내장객체 request가 받는다 
}else if(flag.equals("update")){
	result=dataMgr.updateProduct(request); 
}else if(flag.equals("delete")){
	result=dataMgr.deleteProduct(request.getParameter("no"));
}else{
	response.sendRedirect("DataMgr.jsp");
}

if(result){
%>
	<script>
	alert("처리하였습니다.");
	location.href="file_main.jsp";
	</script>
<%
}else{
%>
	<script>
	alert("오류발생! 관리자에 문의바람.");
	location.href="file_main.jsp";
	</script>
<%
}
	
%>


